package com.homework2.demo2;

import java.util.HashSet;

public class Student {
    //学生选的课程
    private HashSet<Course> courses;
    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public Student(String name) {
        this.name = name;
    }

    public Student(String name, HashSet<Course> courses) {
        this.name = name;
        this.courses = courses;
    }

    public HashSet<Course> getCourses() {
        return courses;
    }

    public void setCourses(HashSet<Course> courses) {
        this.courses = courses;
    }

    public void addCourse(Course course){
        courses.add(course);
    }

    public void removeCourse (String name){
        Course c = courses.iterator().next();
        if (c.getName().equals(name)){
            courses.remove(c);
        }

    }
}
